#ifndef __MONKEYOBJECT_H__
#define __MONKEYOBJECT_H__

#include <js/jsapi.h>
#include <list>
#include "MonkeyContext.h"


class MonkeyObject {
  private:
    MonkeyContext *context;
    std::list<MonkeyObject *> children;

  protected:
    JSObject *object;
	virtual void RegisterObject(MonkeyContext *ctx, JSObject *parent);

  public:
    MonkeyObject();
    ~MonkeyObject();

	JSObject *jsObject();
	MonkeyContext *Context();
	
	void AddObject(MonkeyObject *obj);
	
	// Friends
	friend void MonkeyContext::AddObject(MonkeyObject *);
};

#endif /* __MONKEYOBJECT_H__ */

